[build-system]
requires = ['setuptools>61']
build-backend = "setuptools.build_meta"

[project]
name = "wandb"
dynamic = ["version"]
description = "A CLI and library for interacting with the Weights & Biases API."
authors = [{ name = "Weights & Biases", email = "support@wandb.com" }]
readme = "package_readme.md"
license = { file = "LICENSE" }
requires-python = ">=3.7"
dependencies = [
    "Click>=7.1,!=8.0.0",                                                                # click 8.0.0 is broken
    "GitPython>=1.0.0,!=3.1.29",                                                         # CVE-2022-24439
    "requests>=2.0.0,<3",
    "psutil>=5.0.0",
    "sentry-sdk>=1.0.0",
    "docker-pycreds>=0.4.0",
    "protobuf>=3.12.0,!=4.21.0,<5; python_version < '3.9' and sys_platform == 'linux'",
    "protobuf>=3.15.0,!=4.21.0,<5; python_version == '3.9' and sys_platform == 'linux'",
    "protobuf>=3.19.0,!=4.21.0,<5; python_version > '3.9' and sys_platform == 'linux'",
    "protobuf>=3.19.0,!=4.21.0,<5; sys_platform != 'linux'",
    "PyYAML",
    "setproctitle",
    "setuptools",
    "appdirs>=1.4.3",
    "typing_extensions; python_version < '3.10'",
]
classifiers = [
    "Development Status :: 5 - Production/Stable",
    "Intended Audience :: Developers",
    "Intended Audience :: Science/Research",
    "License :: OSI Approved :: MIT License",
    "Natural Language :: English",
    "Programming Language :: Python :: 3",
    "Programming Language :: Python :: 3.7",
    "Programming Language :: Python :: 3.8",
    "Programming Language :: Python :: 3.9",
    "Programming Language :: Python :: 3.10",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "Programming Language :: Python :: 3 :: Only",
    "Topic :: Scientific/Engineering :: Artificial Intelligence",
    "Topic :: Software Development :: Libraries :: Python Modules",
    "Topic :: System :: Logging",
    "Topic :: System :: Monitoring",
]


[project.scripts]
wandb = "wandb.cli.cli:cli"
wb = "wandb.cli.cli:cli"

[project.urls]
"Source" = "https://github.com/wandb/wandb"
"Bug Reports" = "https://github.com/wandb/wandb/issues"
"Documentation" = "https://docs.wandb.ai/"

[project.optional-dependencies]
kubeflow = ["kubernetes", "minio", "google-cloud-storage", "sh"]
gcp = ["google-cloud-storage"]
aws = ["boto3"]
azure = ["azure-identity", "azure-storage-blob"]
media = [
    "numpy",
    "moviepy",
    "pillow",
    "bokeh",
    "soundfile",
    "plotly>=5.18.0",
    "rdkit-pypi",
]
sweeps = ["sweeps>=0.2.0"]
launch = [
    "awscli",
    "azure-identity",
    "azure-containerregistry",
    "azure-storage-blob",
    "boto3",
    "botocore",
    "chardet",
    "google-auth",
    "google-cloud-aiplatform",
    "google-cloud-artifact-registry",
    "google-cloud-compute",
    "google-cloud-storage",
    "iso8601",
    "kubernetes",
    "kubernetes_asyncio",
    "optuna",
    "nbconvert",
    "nbformat",
    "pydantic",
    "typing_extensions",
    "tomli",
    "PyYAML>=6.0.0",
]
models = ["cloudpickle"]
async = ["httpx>=0.23.0"]
perf = ["orjson"]
importers = ["polars", "rich", "filelock", "mlflow", "tenacity"]
reports = ["pydantic>=2.0.0"]

[tool.setuptools]
zip-safe = false
include-package-data = true
packages = ["wandb"]
package-dir = { "wandb" = "wandb" }
package-data = { "wandb" = ["py.typed"] }

[tool.setuptools.dynamic]
version = { attr = "wandb.__version__" }


[tool.pytest.ini_options]
minversion = "6.0"
console_output_style = "count"
addopts = "-vvv --cov-config=pyproject.toml --dist=loadscope --capture=no"
markers = [
    "image_output",
    "multiclass",
    "wandb_args",
    "flaky",
    "wandb_core_failure(feature): test failures with wandb-core, grouped by feature",
]
timeout = 60
log_format = "%(asctime)s %(levelname)s %(message)s"
log_date_format = "%Y-%m-%d %H:%M:%S"
testpaths = "tests"
filterwarnings = "ignore::DeprecationWarning"
open_files_ignore = "*.ttf"
norecursedirs = [
    "vendor",
    "wandb/vendor",
    "build/",
    "tests/functional_tests",
    "tests/standalone_tests",
]

[tool.coverage.paths]
source = ["wandb", ".tox/*/lib/python*/site-packages/wandb"]

[tool.coverage.run]
# branch = true
concurrency = ["multiprocessing", "thread"]
source = ["wandb"]
omit = ["**/wandb/vendor/**", "**/wandb/proto/**"]

[tool.coverage.report]
exclude_lines = ["pragma: no cover", "if TYPE_CHECKING:", "@abstractmethod"]
omit = ["**/wandb/vendor/**", "**/wandb/proto/**"]
ignore_errors = true


[tool.black]
line-length = 88
target-version = ['py37', 'py38', 'py39', 'py310', 'py311']
include = '\.pyi?$'
exclude = '''
wandb/vendor/
| wandb/bin/
| wandb/proto/
| wandb/proto_check/
| wandb/sdk/launch/deploys/
| wandb/run*
| wandb/offline-run*
| __pycache__
| .pyc
| .tox/
'''

[tool.ruff]
exclude = ["wandb/__init__.py"]
extend-exclude = ["wandb/vendor/**", "wandb/proto/**"]
select = ["F", "E", "W", "B", "I", "N", "D", "C90", "UP"]
ignore = [
    "B904",
    "E501",
    "D1",    # Allow missing docstrings.
    "D417",  # Don't require descriptions for all arguments.
    "UP022",
    "UP032", # Allow using format instead of f-string.
    "UP036",
]
target-version = "py37"

[tool.ruff.isort]
split-on-trailing-comma = false

[tool.ruff.per-file-ignores]
"**/__init__.py" = ["E402", "F401"]
"wandb/__init__.py" = ["I001"]
"wandb/cli/cli.py" = ["C901"]
"wandb/wandb_controller.py" = ["N806"]
"wandb/sklearn/**" = ["B010", "B011", "N803", "N806", "UP031"]
"wandb/wandb_torch.py" = ["C901", "D", "E741", "F841"]
"wandb/integration/metaflow/metaflow.py" = ["F811"]
"wandb/integration/magic.py" = ["B026", "F401", "F841", "N806", "N818"]
"wandb/plots/**" = ["D", "B007", "F401", "N812", "F841", "UP031"]
"wandb/old/**" = ["B006", "B020", "D", "F822"]
"tests/pytest_tests/unit_tests_old/**" = ["B", "C", "D", "E", "F", "N", "UP026"]
"tests/functional_tests/t0_main/fastai/t1_v1.py" = ["F405"]
"tests/functional_tests/t0_main/metaflow/**" = ["D", "N806"]

[tool.ruff.pydocstyle]
convention = "google"

[tool.ruff.pycodestyle]
ignore-overlong-task-comments = true

[tool.ruff.mccabe]
max-complexity = 18

[tool.mypy]
warn_redundant_casts = true
exclude = '''
   (?x)(
      wandb/vendor/.
   )
'''

# wandb.*
[[tool.mypy.overrides]]
module = "wandb.*"
ignore_errors = false

[[tool.mypy.overrides]]
module = [
    "wandb.testing.*",
    "wandb.integration.*",
    "wandb.apis.*",
    "wandb.proto.*",
    "wandb.sklearn.*",
    "wandb.beta.*",
    "wandb.sdk.wandb_login",
    "wandb.cli.*",
    "wandb.wandb_torch.*",
    "wandb.wandb_controller.*",
    "wandb.wandb_agent.*",
    "wandb.sdk.verify.*",
    "wandb.trigger.*",
    "wandb.wandb_summary.*",
    "wandb.jupyter.*",
    "wandb.sync.*",
    "wandb.sdk.integration_utils.*",
    "wandb.plot.*",
    "wandb.plots.*",
    "wandb.old.*",
]
ignore_errors = true

# wandb/env
[[tool.mypy.overrides]]
module = "wandb.env"
ignore_errors = false
disallow_incomplete_defs = true
disallow_untyped_defs = true
warn_unused_ignores = true
warn_return_any = true
warn_unreachable = true
check_untyped_defs = true
disallow_untyped_decorators = true
strict_equality = true
implicit_reexport = false

# wandb/filesync.*
[[tool.mypy.overrides]]
module = "wandb.filesync.*"
ignore_errors = false
disallow_incomplete_defs = true
disallow_untyped_defs = true
warn_unused_ignores = true
warn_return_any = true
warn_unreachable = true
check_untyped_defs = true
disallow_untyped_calls = false
disallow_untyped_decorators = true
strict_equality = true
implicit_reexport = false

# More wandb/ modules can be added in a similar manner as overrides

# External libraries
[[tool.mypy.overrides]]
module = [
    "psutil.*",
    "tensorboard.*",
    "grpc.*",
    "setproctitle.*",
    "ultralytics.*",
    "wandb_gql.*",
    "wandb_graphql.*",
    "wandb.vendor.*",
    "wandb.vendor.pynvml.pynvml.*",
]
ignore_missing_imports = true
